package com.xmy.cultivate.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.xmy.cultivate.entity.SenateDepart;
import com.xmy.cultivate.entity.SenateScore;
import com.xmy.cultivate.mapper.SenateDepartMapper;
import com.xmy.cultivate.mapper.SenateScoreMapper;
import com.xmy.cultivate.service.ISenateDepartService;
import com.xmy.cultivate.service.ISenateScoreService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 教务积分 服务实现类
 * </p>
 *
 * @author hpiggy
 * @since 2024-10-26
 */
@Service
public class SenateScoreServiceImpl extends ServiceImpl<SenateScoreMapper, SenateScore> implements ISenateScoreService {

    @Autowired
    SenateScoreMapper senateScoreMapper;

    @Autowired
    SenateDepartMapper senateDepartMapper;

    /**
     * 教务积分列表
     */
    @Override
    public List<SenateScore> getSenateScoreList(Integer yearPart,
                                                Integer quarterNum,
                                                String startLessonNum,
                                                String endLessonNum,
                                                String subjectsId,
                                                String projectsId,
                                                String startDate,
                                                String endDate,
                                                String schoolId,
                                                String teacherName,
                                                String type,
                                                String yearClassId,
                                                String senateDepartId
    ) {
        return senateScoreMapper.getSenateScoreList(yearPart, quarterNum, startLessonNum, endLessonNum, subjectsId, projectsId, startDate, endDate, schoolId, teacherName, type, yearClassId, senateDepartId);
    }

    /**
     * 教务积分详情
     */
    @Override
    public List<SenateScore> getSenateScoreDetail(Integer yearPart,
                                                  Integer quarterNum,
                                                  Integer startLessonNum,
                                                  Integer endLessonNum,
                                                  Long teacherId,
                                                  String subjectsId,
                                                  String projectsId,
                                                  Integer detailType,
                                                  String startDate,
                                                  String endDate,
                                                  String schoolId,
                                                  String teacherName,
                                                  String yearClassId,
                                                  String senateDepartId
    ) {
        return senateScoreMapper.getSenateScoreDetail(yearPart, quarterNum, startLessonNum, endLessonNum, teacherId, subjectsId, projectsId, detailType, startDate, endDate, schoolId, teacherName, yearClassId, senateDepartId);
    }

    /**
     * 教务积分战队列表
     */
    @Override
    public List<SenateScore> getSenateScoreTeamList(Integer yearPart,
                                                    Integer quarterNum,
                                                    String startLessonNum,
                                                    String endLessonNum,
                                                    String subjectsId,
                                                    String projectsId,
                                                    String startDate,
                                                    String endDate,
                                                    String senateDepartId,
                                                    String trackType,
                                                    String teamId,
                                                    String yearClassId
    ) {

        if (StringUtils.isBlank(senateDepartId)) {
            senateDepartId = senateDepartMapper.getSenateDepartIdStr();
        }

        return senateScoreMapper.getSenateScoreTeamList(yearPart, quarterNum, startLessonNum, endLessonNum, subjectsId, projectsId, startDate, endDate, senateDepartId, trackType, teamId, yearClassId);
    }

    /**
     * 教务积分战队详情
     */
    @Override
    public List<SenateScore> getSenateScoreTeamDetail(Integer yearPart,
                                                      Integer quarterNum,
                                                      Integer startLessonNum,
                                                      Integer endLessonNum,
                                                      Long teacherId,
                                                      String subjectsId,
                                                      String projectsId,
                                                      Integer detailType,
                                                      String startDate,
                                                      String endDate,
                                                      String senateDepartId,
                                                      String trackType,
                                                      String teamId,
                                                      String yearClassId
    ) {

        if (StringUtils.isBlank(senateDepartId)) {
            senateDepartId = senateDepartMapper.getSenateDepartIdStr();
        }

        return senateScoreMapper.getSenateScoreTeamDetail(yearPart, quarterNum, startLessonNum, endLessonNum, teacherId, subjectsId, projectsId, detailType, startDate, endDate, senateDepartId, trackType, teamId, yearClassId);
    }


}
